package com.alibaba.dubbo.demo.consumer;

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;

import com.alibaba.dubbo.demo.DemoService;
import com.alibaba.dubbo.demo.Student;
import com.alibaba.dubbo.rpc.service.GenericService;

import org.springframework.context.support.ClassPathXmlApplicationContext;

/**泛化调用
 * @author zhangsulei
 *
 */
public class Consumer5 {
    public static void main(String[] args) {
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(new String[]{"META-INF/spring/dubbo-demo-consumer.xml"});
        context.start();
        GenericService demoService = (GenericService) context.getBean("demoService5"); // get remote service proxy

        Map<String, Object> map = new HashMap<>();
        map.put("class", "com.alibaba.dubbo.demo.Student");
        map.put("age", 30);
        map.put("name", "abc");
        demoService.$invoke("sayBye", new String[]{"com.alibaba.dubbo.demo.Student"}, new Object[]{map});
    }
}
